<modelglue>

	<controllers>
	
		<controller name="Category" type="it.millemultimedia.easyBlog.controller.CategoryController" >
			
			<event-listener message="Category.new" function="new" />
			<event-listener message="Category.save" function="save" />
			<event-listener message="Category.delete" function="delete" />
			<event-listener message="Category.get" function="get" />
			<event-listener message="Category.list" function="list" />
			
		</controller>
		
		<controller name="Comment" type="it.millemultimedia.easyBlog.controller.CommentController" >
			
			<event-listener message="Comment.new" function="new" />
			<event-listener message="Comment.save" function="save" />
			<event-listener message="Comment.delete" function="delete" />
			<event-listener message="Comment.get" function="get" />
			<event-listener message="Comment.list" function="list" />
			<event-listener message="Comment.listComments" function="listComments" />
			<event-listener message="Comment.last" function="getLast" />
			
		</controller>
		
		<controller name="Post" type="it.millemultimedia.easyBlog.controller.PostController" >
			
			<event-listener message="Post.new" function="new" />
			<event-listener message="Post.save" function="save" />
			<event-listener message="Post.delete" function="delete" />
			<event-listener message="Post.get" function="get" />
			<event-listener message="Post.list" function="list" />
			<event-listener message="Archive.list" function="listArchive" />
			<event-listener message="Post.getPost" function="getPost" />
			<event-listener message="Post.count" function="getPostCount" />
			
		</controller>
		
		<controller name="User" type="it.millemultimedia.easyBlog.controller.UserController" >
			
			<event-listener message="User.new" function="new" />
			<event-listener message="User.save" function="save" />
			<event-listener message="User.get" function="get" />
			<event-listener message="User.list" function="list" />
			
		</controller>
		
		<controller name="Role" type="it.millemultimedia.easyBlog.controller.RoleController" >
			
			<event-listener message="Role.new" function="new" />
			<event-listener message="Role.save" function="save" />
			<event-listener message="Role.get" function="get" />
			<event-listener message="Role.list" function="list" />
			
		</controller>
		
		<controller name="Preference" type="it.millemultimedia.easyBlog.controller.PreferenceController" >
			
			<event-listener message="Preference.list" function="list" />
			
		</controller>
		
		<controller name="Permission" type="it.millemultimedia.easyBlog.controller.PermissionController" >
			
			<event-listener message="Permission.list" function="list" />
			
		</controller>
		
		<controller name="Login" type="it.millemultimedia.easyBlog.controller.LoginController" >
			
			<event-listener message="Login" function="login" />
			<event-listener message="Logout" function="logout" />
			<event-listener message="getLogin" function="getLogin" />
			<event-listener message="onSessionStart" function="getLogin" />
			
		</controller>
		
		<controller name="Blog" type="it.millemultimedia.easyBlog.controller.BlogController" >
			
			<event-listener message="Blog.save" function="save" />
			<event-listener message="Blog.get" function="get" />
			<event-listener message="OnRequestStart" function="get" />
			
		</controller>
		
		<controller name="Setting" type="it.millemultimedia.easyBlog.controller.SettingController" >
			
			<event-listener message="Setting.save" function="save" />
			<event-listener message="Setting.get" function="get" />
			
		</controller>
		
		<controller name="Skin" type="it.millemultimedia.easyBlog.controller.SkinController" >
			
			<event-listener message="Skin.save" function="save" />
			<event-listener message="Skin.delete" function="delete" />
			<event-listener message="onApplicationStart" function="setSkin" />
			<event-listener message="getSkin" function="getSkin" />
			<event-listener message="onRequestStart" function="getSkin" />
			
		</controller>
		
	</controllers>
	
	<event-types>
	
		<event-type name="login">
			<before>
				<broadcasts>
					<message name="getLogin" />
				</broadcasts>
				<results>
					<result name="isNotLogged" do="login" redirect="true" />
				</results>
			</before>
		</event-type>
	
		<event-type name="user">
			<before>
				<views>
					<include name="sidebar" template="/admin/security/Menu.cfm" append="true">
						<value name="position" value="users" />
					</include>
				</views>
			</before>
		</event-type>
		
		<event-type name="post">
			<after>
				<views>
					<include name="sidebar" template="/admin/post/Menu.cfm" append="true">
						<value name="position" value="posts" />
					</include>
					<include name="sidebar" template="/admin/comment/Menu.cfm" append="true" />
				</views>
			</after>
		</event-type>
		
		<event-type name="category">
			<after>
				<views>
					<include name="sidebar" template="/admin/category/Menu.cfm" append="true">
						<value name="position" value="categories" />
					</include>
				</views>
			</after>
		</event-type>
		
		<event-type name="dashboard">
			<after>
				<views>
					<include name="sidebar" template="/admin/ui/menu.cfm" append="true">
						<value name="position" value="dashboard" />
					</include>
				</views>
			</after>
		</event-type>
		
		<event-type name="setting">
			<after>
				<views>
					<include name="sidebar" template="/admin/settings/Menu.cfm" append="true">
						<value name="position" value="settings" />
					</include>
				</views>
			</after>
		</event-type>
		
		<event-type name="editor">
			<after>
				<views>
					<include name="editor" template="/admin/ui/tinyMce.cfm"/>
				</views>
			</after>
		</event-type>
		
	</event-types>
	
	<event-handlers>
	
		<!-- role -->
		
		<event-handler name="form.Role" access="private">
			<broadcasts>
				<message name="Permission.list"/>
				<message name="Preference.list"/>
			</broadcasts>
			<views>
				<include name="content" template="/admin/security/Role.cfm" >
					<value name="action" value="save.Role" />
				</include>
			</views>
			<results>
				<result do="private" />
			</results>
		</event-handler>
		
		<event-handler name="new.Role" type="user,login,editor">
			<broadcasts>
				<message name="Role.new" />
			</broadcasts>
			<results>
				<result do="form.Role" />
			</results>
		</event-handler>
		
		<event-handler name="edit.Role" type="user,login,editor">
			<broadcasts>
				<message name="Role.get" />
			</broadcasts>
			<results>
				<result do="form.Role" />
			</results>
		</event-handler>
		
		<event-handler name="save.Role" type="user,login,editor">
			<broadcasts>
				<message name="Role.save" />
			</broadcasts>
			<results>
				<result name="save.success" do="list.Role" redirect="true" />
				<result name="save.failure" do="form.Role" redirect="false" />
			</results>
		</event-handler>
		
		<event-handler name="list.Role" type="user,login">
			<broadcasts>
				<message name="Role.list" />
			</broadcasts>
			<views>
				<include name="content" template="/admin/security/RoleGrid.cfm" />
			</views>
			<results>
				<result do="private" />
			</results>
		</event-handler>
	
		<!-- user -->
		
		<event-handler name="form.User" access="private">
			<broadcasts>
				<message name="Role.list" />
			</broadcasts>
			<views>
				<include name="content" template="/admin/security/User.cfm">
					<value name="action" value="save.User" />
				</include>
			</views>
			<results>
				<result do="private" />
			</results>
		</event-handler>
		
		<event-handler name="new.User" type="user,login,editor">
			<broadcasts>
				<message name="User.new" />
			</broadcasts>
			<results>
				<result do="form.User" />
			</results>
		</event-handler>
		
		<event-handler name="edit.User" type="user,login,editor">
			<broadcasts>
				<message name="User.get" />
			</broadcasts>
			<results>
				<result do="form.User" />
			</results>
		</event-handler>
		
		<event-handler name="save.User" type="user,login,editor">
			<broadcasts>
				<message name="User.save" />
			</broadcasts>
			<results>
				<result name="save.success" do="list.User" redirect="true" />
				<result name="save.failure" do="form.User" redirect="false" />
			</results>
		</event-handler>
		
		<event-handler name="delete.User" type="user,login">
			<broadcasts>
				<message name="User.delete" />
			</broadcasts>
			<results>
				<result name="save.success" do="list.User" redirect="true" />
				<result name="save.failure" do="form.User" redirect="false" />
			</results>
		</event-handler>
		
		<event-handler name="list.User" type="user,login">
			<broadcasts>
				<message name="User.list" />
			</broadcasts>
			<views>
				<include name="content" template="/admin/security/Grid.cfm" />
			</views>
			<results>
				<result do="private" />
			</results>
		</event-handler>
	
		<!-- post -->
		
		<event-handler name="form.Post" access="private">
			<broadcasts>
				<message name="Category.list" />
			</broadcasts>
			<views>
				<include name="content" template="/admin/post/Post.cfm">
					<value name="action" value="save.Post" />
				</include>
			</views>
			<results>
				<result do="private" />
			</results>
		</event-handler>
		
		<event-handler name="new.Post" type="post,login,editor">
			<broadcasts>
				<message name="Post.new" />
			</broadcasts>
			<results>
				<result do="form.Post" />
			</results>
		</event-handler>
		
		<event-handler name="edit.Post" type="post,login,editor">
			<broadcasts>
				<message name="Post.get" />
			</broadcasts>
			<results>
				<result do="form.Post" />
			</results>
		</event-handler>
		
		<event-handler name="save.Post" type="post,login,editor">
			<broadcasts>
				<message name="Post.save" />
			</broadcasts>
			<results>
				<result name="save.success" do="list.Post" redirect="true" />
				<result name="save.failure" do="form.Post" redirect="false" />
			</results>
		</event-handler>
		
		<event-handler name="delete.Post" type="post,login">
			<broadcasts>
				<message name="Post.delete" />
			</broadcasts>
			<results>
				<result name="save.success" do="list.Post" redirect="true" />
				<result name="save.failure" do="list.Post" redirect="true" />
			</results>
		</event-handler>
		
		<event-handler name="list.Post" type="post,login">
			<broadcasts>
				<message name="Post.list" />
			</broadcasts>
			<views>
				<include name="content" template="/admin/post/grid.cfm" />
				<include name="sideBar" template="admin/ui/search.cfm" append="true" />
				<include name="sideBar" template="admin/ui/calendar.cfm" append="true" />
			</views>
			<results>
				<result do="private" />
			</results>
		</event-handler>
	
		<!-- comment -->
		
		<event-handler name="form.Comment" access="private">
			<views>
				<include name="content" template="/admin/comment/Comment.cfm">
					<value name="action" value="save.Comment" />
				</include>
			</views>
			<results>
				<result do="private" />
			</results>
		</event-handler>
		
		<event-handler name="new.Comment" type="login,post,editor">
			<broadcasts>
				<message name="Comment.new" />
			</broadcasts>
			<results>
				<result do="form.Comment" />
			</results>
		</event-handler>
		
		<event-handler name="edit.Comment" type="login,post,editor">
			<broadcasts>
				<message name="Comment.get" />
			</broadcasts>
			<results>
				<result do="form.Comment" />
			</results>
		</event-handler>
		
		<event-handler name="save.Comment" type="login,post,editor">
			<broadcasts>
				<message name="Comment.save" />
			</broadcasts>
			<results>
				<result name="save.success" do="list.Comment" redirect="true" />
				<result name="save.failure" do="form.Comment" redirect="false" />
			</results>
		</event-handler>
		
		<event-handler name="delete.Comment" type="login,post">
			<broadcasts>
				<message name="Comment.delete" />
			</broadcasts>
			<results>
				<result name="save.success" do="list.Comment" redirect="true" />
				<result name="save.failure" do="list.Comment" redirect="true" />
			</results>
		</event-handler>
		
		<event-handler name="list.Comment" type="login,post">
			<broadcasts>
				<message name="Comment.list" />
			</broadcasts>
			<views>
				<include name="content" template="/admin/comment/Grid.cfm" />
			</views>
			<results>
				<result do="private" />
			</results>
		</event-handler>
	
		<!-- category -->
		
		<event-handler name="form.Category" access="private">
			<views>
				<include name="content" template="/admin/category/Category.cfm">
					<value name="action" value="save.Category"/>
				</include>
			</views>
			<results>
				<result do="private" />
			</results>
		</event-handler>
		
		<event-handler name="new.Category" type="login,category,editor">
			<broadcasts>
				<message name="Category.new" />
			</broadcasts>
			<results>
				<result do="form.Category" />
			</results>
		</event-handler>
		
		<event-handler name="edit.Category" type="login,category,editor">
			<broadcasts>
				<message name="Category.get" />
			</broadcasts>
			<results>
				<result do="form.Category" />
			</results>
		</event-handler>
		
		<event-handler name="save.Category" type="login,category,editor">
			<broadcasts>
				<message name="Category.save" />
			</broadcasts>
			<results>
				<result name="save.success" do="list.Category" redirect="true" />
				<result name="save.failure" do="form.Category" redirect="false" />
			</results>
		</event-handler>
		
		<event-handler name="delete.Category" type="login,category">
			<broadcasts>
				<message name="Category.delete" />
			</broadcasts>
			<results>
				<result name="save.success" do="list.Category" redirect="true" />
				<result name="save.failure" do="list.Category" redirect="true" />
			</results>
		</event-handler>
		
		<event-handler name="list.Category" type="login,category">
			<broadcasts>
				<message name="Category.list" />
			</broadcasts>
			<views>
				<include name="content" template="/admin/category/grid.cfm" />
			</views>
			<results>
				<result do="private" />
			</results>
		</event-handler>
		
		<!-- login -->
		
		<event-handler name="login">
			<views>
				<include name="assets" template="admin/assets.cfm" />
				<include name="body" template="admin/login.cfm" />
			</views>
			<results>
				<result do="main" />
			</results>
		</event-handler>
		
		<event-handler name="do.login">
			<broadcasts>
				<message name="login" />
			</broadcasts>
			<views>
				<include name="assets" template="admin/assets.cfm" />
				<include name="body" template="admin/login.cfm" />
			</views>
			<results>
				<result name="success" do="dashboard" redirect="true" />
				<result name="invalid" do="login" redirect="true" />
			</results>
		</event-handler>
		
		<event-handler name="do.logout">
			<broadcasts>
				<message name="logout" />
			</broadcasts>
			<results>
				<result do="login" redirect="true" />
			</results>
		</event-handler>
		
		<!-- settings -->
		
		<event-handler name="form.Blog" access="private">
			<views>
				<include name="content" template="/admin/settings/Blog.cfm" >
					<value name="action" value="save.Blog" />
				</include>
			</views>
			<results>
				<result do="private" />
			</results>
		</event-handler>
		
		<event-handler name="edit.Blog" type="login,setting,editor">
			<broadcasts>
				<message name="Blog.get" />
			</broadcasts>
			<results>
				<result do="form.Blog" />
			</results>
		</event-handler>
		
		<event-handler name="save.Blog" type="login,setting,editor">
			<broadcasts>
				<message name="Blog.save" />
			</broadcasts>
			<results>
				<result name="save.success" do="form.Blog" redirect="false" />
				<result name="save.failure" do="form.Blog" redirect="false" />
			</results>
		</event-handler>
		
		<event-handler name="form.Setting" access="private">
			<views>
				<include name="content" template="/admin/settings/Setting.cfm" >
					<value name="action" value="save.Setting" />
				</include>
			</views>
			<results>
				<result do="private" />
			</results>
		</event-handler>
		
		<event-handler name="edit.Setting" type="login,setting,editor">
			<broadcasts>
				<message name="Setting.get" />
			</broadcasts>
			<results>
				<result do="form.Setting" />
			</results>
		</event-handler>
		
		<event-handler name="save.Setting" type="login,setting,editor">
			<broadcasts>
				<message name="Setting.save" />
			</broadcasts>
			<results>
				<result name="save.success" do="form.Setting" redirect="false" />
				<result name="save.failure" do="form.Setting" redirect="false" />
			</results>
		</event-handler>
		
		<event-handler name="form.Skin" access="private">
			<views>
				<include name="content" template="/admin/settings/Skin.cfm" />
			</views>
			<results>
				<result do="private" />
			</results>
		</event-handler>
		
		<event-handler name="save.Skin" type="login,setting,editor">
			<broadcasts>
				<message name="Skin.save" />
			</broadcasts>
			<results>
				<result name="save.success" do="" redirect="true" />
				<result name="save.failure" do="" redirect="true" />
			</results>
		</event-handler>
		
		<event-handler name="delete.Skin" type="login,setting,editor">
			<broadcasts>
				<message name="Skin.delete" />
			</broadcasts>
			<results>
				<result name="save.success" do="" redirect="true" />
				<result name="save.failure" do="" redirect="true" />
			</results>
		</event-handler>
		
		<event-handler name="list.Skin" type="login,setting,editor">
			<broadcasts>
				<message name="Skin.list" />
			</broadcasts>
		</event-handler>
		
		<event-handler name="files" type="login">
			<views>
				<include name="content" template="/admin/files/iframe.cfm" />
			</views>
			<results>
				<result do="private" />
			</results>
		</event-handler>
		
		<event-handler name="fileManager" type="login">
			<views>
				<include name="content" template="/admin/files/filemanager.cfm" />
			</views>
		</event-handler>
		
		<!-- dashboard -->
	
		<event-handler name="dashboard" type="login,dashboard">
			<broadcasts>
				<message name="Post.list"/>
			</broadcasts>
			<views>
				<include name="content" template="admin/ui/dashBoard.cfm" />
			</views>
			<results>
				<result do="private" />
			</results>
		</event-handler>
		
		<event-handler name="admin" type="login">
			<results>
				<result do="dashboard" />
			</results>
		</event-handler>
	
		<!-- private -->
	
		<event-handler name="private" access="private">
			<views>
				<include name="header" template="admin/ui/systemMenu.cfm" />
				<include name="header" template="admin/ui/topMenu.cfm" append="true" />
				<include name="assets" template="admin/assets.cfm" />
				<include name="message" template="admin/ui/dspError.cfm"/>
				<include name="body" template="admin/body.cfm" />
			</views>
			<results>
				<result do="main" />
			</results>
		</event-handler>
		
		<!-- public -->
		
		<event-handler name="blog">
			<broadcasts>
				<message name="Archive.list"/>
			</broadcasts>
			<views>
				<include name="body" template="/blog/main.cfm" >
					<value name="template.skin" value="index" />
				</include>
			</views>
			<results>
				<result do="public" />
			</results>
		</event-handler>
		
		<event-handler name="post">
			<broadcasts>
				<message name="Post.getPost" />
				<message name="Comment.listComments" />
			</broadcasts>
			<views>
				<include name="body" template="/blog/main.cfm" >
					<value name="template.skin" value="blog" />
				</include>
			</views>
			<results>
				<result do="public" />
			</results>
		</event-handler>
		
		<event-handler name="add.comment">
			<broadcasts>
				<message name="Comment.save" />
			</broadcasts>
			<results>
				<result do="post" redirect="true" append="idPost" />
			</results>
		</event-handler>
		
		<event-handler name="archives">
			<broadcasts>
				<message name="Archive.list" />
			</broadcasts>
			<views>
				<include name="body" template="/blog/main.cfm" >
					<value name="template.skin" value="archives" />
				</include>
			</views>
			<results>
				<result do="public" />
			</results>
		</event-handler>
		
		<!-- private -->
		
		<event-handler name="public" access="private">
			<broadcasts>
				<message name="Comment.last">
					<argument name="maxRow" value="5" />
				</message>
				<message name="Post.count" />
			</broadcasts>
			<results>
				<result do="main" />
			</results>
		</event-handler>
		
		<event-handler name="main" access="private">
			<views>
				<include name="main" template="main.cfm" />
			</views>
		</event-handler>
		
	</event-handlers>
	
</modelglue>